# -*- coding: utf-8 -*-

import csv
path = "E:/课题论文/大气RCM/Precipitation_2070-2099_Daily_PRECIS_HadGEM2-ES_RCP4.5_24.7551_118.0341/"
csv_file = csv.reader(open(path + "datafile.csv"))
# print(csv_file)
count = 0
with open(path + "datestamp.txt") as txtDate:
    combineTxt = open(path + "dataCombine.txt", "w")
    for prec in csv_file:
        c_date = txtDate.readline()
        if not c_date:
            break
        # if count > 10:
        #     break
        # count += 1
        # print(c_date.replace("\n", "") + " " + prec[0])
        if float(prec[1]) <= float(prec[2]):
            print(c_date + " Max:" + prec[1] + " Min:" + prec[2] + "Error!")
        combineTxt.write(c_date.replace("\n", "") + " "+prec[0] + " "+prec[1] + " "+prec[2] + "\n")
